<?php

class Spidercreate extends CI_Controller{
    
    function index(){
        header("Content-type:text/html;charset=utf-8");
        $this->load->model("Spider_set");
        $data = $this->Spider_set->select_domain();

        $result["data"] = $data->result();
        $data_json_str = json_encode($data->result());
        $this->load->helper('cookie');
        $this->input->set_cookie(array('step' => 'domainset'));
        $result["data_json"] = $data_json_str;
        $this->load->helper("url");
        $this->load->view("headernone", $result);
        $this->load->view("/admin/create");
    }


    function domainset(){
        $this->load->model("Spider_set");
        $data = $this->Spider_set->add_domain();
        $this->load->library("myclass");
        
        if($data===TRUE){
            $result = array("code"=>0, "msg"=>"update data success");    
            echo json_encode($result);

        }else{
            $code = 1;
            $msg = $this->myclass->hand_message($code);

            echo json_encode(array("code"=>1, "msg"=>$msg));
        }
    }

    function delete($name){
        $this->load->model("Spider_set");
        $data =  $this->Spider_set->delete();
        $this->load->helper("url");
        var_dump($data[3]);
        //redirect("/spidercreate/"); 
    }
}
?>
